我目前正在尝试使用pyenv创建一个新的虚拟环境,我使用pyenv安装了不同版本的python,从3.7.x到3.9.x。
为了创建一个环境,我将执行以下操作:
$pyenv virtualenv 3.8.7 practice_django它创建环境并输出它:
Looking in links: /var/folders/w1/dw5vm6p955bgmws4x53sjlym0000gn/T/tmpwltofgj8
Requirement already satisfied: setuptools in /Users/apple/.pyenv/versions/3.8.7/envs/practice_rasa/lib/python3.8/site-packages (49.2.1)
Requirement already satisfied: pip in /Users/apple/.pyenv/versions/3.8.7/envs/practice_django/lib/python3.8/site-packages (20.2.3)然后,我使用以下方法激活环境:
$pyenv activate practice_django并检查虚拟环境是否已成功创建,并通过以下方法正确:
$pyenv which python
/Users/apple/.pyenv/versions/practice_django/bin/python
$python -V
Python 3.8.7 # my global python is 3.7.5
$pip -V
pip 20.2.3 from /Users/apple/.pyenv/versions/3.8.7/envs/practice_django/lib/python3.8/site-packages/pip (python 3.8)因此,我知道环境应该被正确地创建并被激活。
现在,当我执行pip list时,我得到以下内容(没有安装任何软件包):
Package Version
----------------------- ------------
absl-py 0.12.0
aio-pika 6.8.0
aiofiles 0.7.0
aiormq 3.3.1
alembic 1.4.3
APScheduler 3.7.0
astunparse 1.6.3
async-generator 1.10
async-timeout 3.0.1
attrs 19.3.0
bidict 0.21.2
boto3 1.17.78
botocore 1.20.78
cachetools 4.2.2
certifi 2020.12.5
cffi 1.14.5
cloudpickle 1.6.0
colorclass 2.2.0
coloredlogs 15.0
colorhash 1.0.3
croniter 1.0.13
cryptography 3.4.7
cycler 0.10.0
dm-tree 0.1.6
dnspython 1.16.0
docopt 0.6.2
fbmessenger 6.0.0
future 0.18.2
gast 0.3.3
gitdb 4.0.7
GitPython 3.1.17
google-auth 1.30.0
google-auth-oauthlib 0.4.4
google-pasta 0.2.0
greenlet 1.1.0
grpcio 1.38.0
h11 0.9.0
h5py 2.10.0
httpcore 0.11.1
httplib2 0.19.1
httptools 0.2.0
httpx 0.15.4
humanfriendly 9.1
idna 2.10
isodate 0.6.0
jmespath 0.10.0
joblib 0.15.1
jsonpickle 2.0.0
jsonschema 3.2.0
kafka-python 1.4.7
Keras-Preprocessing 1.1.2
kiwisolver 1.3.1
Mako 1.1.4
Markdown 3.3.4
MarkupSafe 2.0.1
matplotlib 3.3.4
mattermostwrapper 2.2
networkx 2.5.1
numpy 1.18.5
oauth2client 4.1.3
oauthlib 3.1.0
opt-einsum 3.3.0
packaging 20.9
pamqp 2.3.0
pika 1.2.0
Pillow 8.2.0
pip 20.2.3
prompt-toolkit 2.0.10
protobuf 3.17.0
psycopg2-binary 2.8.6
pyasn1 0.4.8
pyasn1-modules 0.2.8
pycparser 2.20
pydot 1.4.2
pykwalify 1.8.0
pymongo 3.10.1
pyparsing 2.4.7
pyrsistent 0.17.3
pyTelegramBotAPI 3.7.9
python-crfsuite 0.9.7
python-dateutil 2.8.1
python-editor 1.0.4
python-engineio 4.2.0
python-socketio 5.3.0
pytz 2021.1
PyYAML 5.4.1
rasa 2.6.2
rasa-sdk 2.6.0
rasa-x 0.39.3
redis 3.5.3
regex 2020.9.27
requests 2.25.1
requests-oauthlib 1.3.0
requests-toolbelt 0.9.1
rfc3986 1.5.0
rocketchat-API 1.15.0
rsa 4.7.2
ruamel.yaml 0.16.13
ruamel.yaml.clib 0.2.2
s3transfer 0.4.2
Sanic-Cors 0.10.0.post3
Sanic-Plugins-Framework 0.9.5
scikit-learn 0.24.2
scipy 1.6.3
sentry-sdk 0.19.5
setuptools 49.2.1
six 1.16.0
sklearn-crfsuite 0.3.6
slackclient 2.9.3
smmap 4.0.0
sniffio 1.2.0
SQLAlchemy 1.3.22
tabulate 0.8.9
tensorboard 2.5.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.0
tensorflow 2.3.2
tensorflow-addons 0.12.0
tensorflow-estimator 2.3.0
tensorflow-hub 0.10.0
tensorflow-probability 0.11.1
tensorflow-text 2.3.0
termcolor 1.1.0
terminaltables 3.1.0
threadpoolctl 2.1.0
tqdm 4.59.0
twilio 6.50.1
typeguard 2.12.0
typing-extensions 3.10.0.0
tzlocal 2.1
ujson 1.35
urllib3 1.26.4
uvloop 0.14.0
wcwidth 0.2.5
webexteamssdk 1.6
websockets 8.1
Werkzeug 2.0.1
wheel 0.36.2
wrapt 1.12.1
yarl 1.6.3
WARNING: You are using pip version 20.2.3; however, version 21.1.2 is available.
You should consider upgrading via the '/Users/apple/.pyenv/versions/3.8.7/envs/practice_django/bin/python3.8 -m pip install --upgrade pip' command.当我尝试卸载时,会发生这样的情况:
$pip uninstall tensorflow
Found existing installation: tensorflow 2.3.2
Not uninstalling tensorflow at /Users/apple/.pyenv/versions/3.8.7/envs/practice_rasa/lib/python3.8/site-packages, outside environment /Users/apple/.pyenv/versions/3.8.7/envs/practice_django
Can't uninstall 'tensorflow'. No files were found to uninstall.这表明,我的virtualenv practice_django可能正在使用来自另一个虚拟practice_rasa的包。
现在,如果我尝试导入tensorflow,我可以导入它。
我想要创建一个干净的virtualenv,没有安装任何包--今天就开始得到这个错误了。
P.S :即使我创建了一个具有不同版本的环境,比如3.7.9,我也会得到相同的错误。我也尝试过升级pip版本--这没有帮助。
对于基于python3.7.9的virtualenv,我在pip卸载上得到了类似的信息
Found existing installation: websockets 8.1
Not uninstalling websockets at /Users/apple/.pyenv/versions/3.8.7/envs/practice_rasa/lib/python3.8/site-packages, outside environment /Users/apple/.pyenv/versions/3.7.9/envs/practice_django
Can't uninstall 'websockets'. No files were found to uninstall.websockets包似乎位于虚拟环境practice_rasa,上,该环境具有python 3.8.7。
发布于 2022-04-01 18:19:53
根据我的经验,您可能同时使用conda和pyenv。您可能希望从您的~/..bash_profile或~/..zshrc文件中删除任何conda files语句。
https://stackoverflow.com/questions/67776639
复制相似问题