简体   繁体   中英

Installing python site-packages in virtual environment

Well, I have already installed python and some site-packages (including pandas) but I have learned about virtual enviroments and want to use it. I want to install pandas to my VE. First of all, I did this:

(python_venv) denis@denis-laptop:~$ pip3 install pandas

And got:

...
PermissionError: [Errno 13] Отказано в доступе: '/environments/python_venv/lib/python3.7/site-packages/six.py'

So, I did:

(python_venv) denis@denis-laptop:~$ pip3 install --user pandas

Got:

...
Installing collected packages: numpy, six, python-dateutil, pytz, pandas
Successfully installed numpy-1.15.4 pandas-0.23.4 python-dateutil-2.7.5 pytz-2018.7 six-1.11.0

But I haven't got pandas in pip3 list:

(python_venv) denis@denis-laptop:~$ pip3 list --format=columns
Package       Version
------------- -------
pip           9.0.1  
pkg-resources 0.0.0  
setuptools    39.0.1 

What should I do? I have Ubuntu 18.04.

Looks like a permission issue: you should be able to write files in your virtual environment as your user and the --user option should omitted. I suggest you change the ownership of the virtualenv as follows:

chown -R $(whoami):$(whoami) /environments/python_venv

and then try the first pip install pandas again

Considering Successfully installed numpy-1.15.4 pandas-0.23.4 you probably have it installed. Did you try running pip list --user ?

You have installed pandas to user install folder and possibly this does not show in the general pip list command. You can notice that the output of pip list is missing not only pandas but actually all the packages you installed with pip3 install --user pandas . Btw., there is no need to specify --format=columns , as it's the default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM